package org.example.sort;

import java.math.BigDecimal;

/**
 * <p>
 * Description:TODO 详细描述
 * <p>
 * <p>
 *
 * @author anlu
 * @date 2022/7/7 11:10
 */
public class StringSubUtils {

    public static Double subStringMacVersion(String ua){
        int offset = "LDClientMac_".length();
        int endIndex = ua.indexOf("_MacOSX",offset);

        String version = ua.substring(offset,endIndex);

//       7.26.8.0   7.600
        int pointEndIndex = version.indexOf(".");

        int pointIndex = version.indexOf(".",pointEndIndex+1);
        String macVersionStr = version.substring(0,pointIndex);


        return Double.parseDouble(macVersionStr);
    }

    public static void main(String[] args) {
        Double res = StringSubUtils.subStringMacVersion("LDClientMac_70.690.8.0_MacOSX_10.16");
        System.out.println(res);
    }

}
